__author__ = 'Brendan'

import unittest
from ChessBoard import *

class TestMoveBishop(unittest.TestCase):
	
	def setUp(self):
		self.cb = ChessBoard()

	def tearDown(self):
		self.cb = None

	# Attempt valid moves
	# Front-left
	def testValidMoveFrontLeft(self):
		self.assertTrue(self.cb.moveBishop((3,3),(2,4)))

	# Front-right
	def testValidMoveFrontRight(self):
		self.assertTrue(self.cb.moveBishop((3,3),(4,4)))

	# Back-left
	def testValidMoveBackLeft(self):
		self.assertTrue(self.cb.moveBishop((4,4),(3,3)))

	# Back-right
	def testValidMoveBackRight(self):
		self.assertTrue(self.cb.moveBishop((4,4),(5,3)))


	# Attempt invalid moves - expecting each to return false
	# Try moving to square piece is already on
	def testInvalidMoveToSameSquare(self):
		self.assertFalse(self.cb.moveBishop((1, 1), (1, 1)))

	# Should return false when attempting invalid move - though a valid square
	def testInvalidMoveForward(self):
		self.assertFalse(self.cb.moveBishop((3,3),(3,4)))

	def testInvalidMoveBack(self):
		self.assertFalse(self.cb.moveBishop((4,4),(4,3)))

	def testInvalidMoveLeft(self):
		self.assertFalse(self.cb.moveBishop((4,4),(3,4)))

	def testInvalidMoveRight(self):
		self.assertFalse(self.cb.moveBishop((4,4),(5,4)))

	#  Expect to return false when attempting a move to beyond board
	def testInvalidMoveBeyondBoard(self):
		self.assertFalse(self.cb.moveBishop((1,1), (1,768)))

	# Expect false when from position is outside the board
	def testInvalidMoveStartOutsideBoard(self):
		self.assertFalse(self.cb.moveBishop((-5, -5), (1, 1)))


if __name__ == "__main__":
	unittest.main()